*******************************************************************************
*
* Code that reads in parameters, programs for outputting numbers, as well as the site-level data
*
*******************************************************************************


******** Graphing options:
graph set window fontfaceserif default 

******** Set up:

scalar bs_reps = 1000
scalar bs_reps_lpoly = 1000

** Social methane cost calculations from Hausman and Muehlenbachs:
scalar methane_price_mcf = 27 // from hausman and muehlenbachs
scalar inflation_adj_2019_to_2023 = 1.19 // from BLM inflation calculator, using January 2019 and January 2023 
scalar kg_to_mcf_conversion = 1/20.218 // from NRC

** Methane price calculatiosn from Agerton who in turn take it from 
* https://www.whitehouse.gov/wp-content/uploads/2021/02/TechnicalSupportDocument_SocialCostofCarbonMethaneNitrousOxide.pdf
scalar methane_price_ton = 1500  // https://www.whitehouse.gov/wp-content/uploads/2021/02/TechnicalSupportDocument_SocialCostofCarbonMethaneNitrousOxide.pdf
scalar ton_to_kg_conversion = 0.001 // The tons above are metric tons so 1 kg = 0.001 metric tons
scalar inflation_adj_2020_to_2023 = 1.16 // from BLM inflation calculator, using January 2918 and January 2923 (https://www.bls.gov/data/inflation_calculator.htm)

** dollar cost of one kg of methane:
scalar social_cost_methane_v1 = methane_price_mcf * inflation_adj_2019_to_2023 * kg_to_mcf_conversion 
scalar social_cost_methane_v2 = methane_price_ton * inflation_adj_2020_to_2023 * ton_to_kg_conversion

di social_cost_methane_v1
di social_cost_methane_v2


set seed 14

************* Programs:

* For writing something (the `anything') that is not enclosed by double quotes:
cap program drop write_single_num
program define write_single_num
	syntax anything, Filename(string)
	cap erase "`filename'"
	cap file close temp_file
	file open temp_file using "`filename'", write
	file write temp_file "`anything'"
	file close temp_file

end

* For writing something (the `anything') that IS enclosed by double quotes:
cap program drop write_single_string
program define write_single_string
	syntax anything, Filename(string)
	cap erase "`filename'"
	cap file close temp_file
	file open temp_file using "`filename'", write
	file write temp_file `anything'
	file close temp_file

end


************** Reads in data:

use "Data/Intermediate/site_level_for_analysis.dta", clear


